package com.ibeeking.found.common.enums;

public enum LanguageI18CodeEnum {
    ZH_CN("简体中文", "zh_CN"),
    ZH_TW("繁体中文", "zh_TW"),
    EN_US("英文", "en");

    private String name;
    private String code;

    LanguageI18CodeEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public static String getNameByCode(String code) {
        for (LanguageI18CodeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static LanguageI18CodeEnum getEnumByCode(String code) {
        for (LanguageI18CodeEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
